package entity;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


/**
 * The persistent class for the nomikai database table.
 * 
 */
@Entity
@Table(name="nomikai")
@NamedQueries(@NamedQuery(name = "findById", query = "select t from Nomikai t where t.nomikaiid=:nomikaiid"))
public class Nomikai implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(unique=true, nullable=false)
	private long nomikaiid;

	//@Temporal(TemporalType.DATE)
	@Column(nullable=false)
	private Date date;

	@Column(length=100)
	private String detail;

	@Column(length=45)
	private String name;

	//bi-directional many-to-one association to Nomikaimember
	@OneToMany(mappedBy="nomikaiid", cascade={CascadeType.ALL})
	private Set<Nomikaimember> nomikaimemberCollection;

	public Nomikai() {
	}

	public long getNomikaiid() {
		return this.nomikaiid;
	}

	public void setNomikaiid(long nomikaiid) {
		this.nomikaiid = nomikaiid;
	}

	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getDetail() {
		return this.detail;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Set<Nomikaimember> getNomikaimemberCollection() {
		return this.nomikaimemberCollection;
	}

	public void setNomikaimemberCollection(Set<Nomikaimember> nomikaimemberCollection) {
		this.nomikaimemberCollection = nomikaimemberCollection;
	}

	public Nomikaimember addNomikaimemberCollection(Nomikaimember nomikaimemberCollection) {
		getNomikaimemberCollection().add(nomikaimemberCollection);
		nomikaimemberCollection.setNomikaiid(this);

		return nomikaimemberCollection;
	}

	public Nomikaimember removeNomikaimemberCollection(Nomikaimember nomikaimemberCollection) {
		getNomikaimemberCollection().remove(nomikaimemberCollection);
		nomikaimemberCollection.setNomikaiid(null);

		return nomikaimemberCollection;
	}

}